<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script src="/libs/react.development.js"></script>
    <script src="/libs/react-dom.development.js"></script>
    <script src="/libs/babel.min.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      class Count extends React.Component {
        constructor(props) {
          console.log("constructor");
          super(props);
          this.state = {
            count: 0,
          };
        }
        render() {
          console.log("render");
          return (
            <div>
              Sum:{this.state.count}
              <button onClick={this.add}>+1</button>
            </div>
          );
        }
        add = () => {
          this.setState({ count: this.state.count + 1 });
        };
        shouldComponentUpdate() {
          console.log("shouldComponentUpdate");
          return true;
        }
        componentWillMount() {
          console.log("componentWillMount");
        }
        componentDidMount() {
          console.log("componentDidMount");
        }
        componentWillUpdate() {
          console.log("componentWillUpdate");
        }
        componentDidUpdate() {
          console.log("componentDidUpdate");
        }
        componentWillUnmount() {
          console.log("componentWillUnmount");
        }
      }
      ReactDOM.render(<Count />, document.getElementById("root"));
    </script>
  </body>
</html>
